<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:outputStylesheet library="css" name="styleTables.css" />

<f:view>
	<h:head>
		<title>Willkommen in der CatLib</title>
	</h:head>
	<h:body>
		<h:graphicImage library="img" value="/img/catlib.png"></h:graphicImage>
		<br></br>
		<br></br>
		<h:form id="form">
			<p:dataTable var="bk" value="#{tableBks.bkList}" id="bkList"
				editable="true" style="width:80%">

				<f:facet name="header">  
	            Bücherliste  
	        </f:facet>

				<p:column headerText="ISBN" style="width:15%">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{bk.isbn}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{bk.isbn}" style="width:100%" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="Titel" style="width:40%">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{bk.titel}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{bk.titel}" style="width:100%" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="Autor" style="width:30%">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{bk.autor}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{bk.autor}" style="width:100%" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="Ausgeliehen von" style="width:15%">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{bk.matrikel}" />
						</f:facet>
						<f:facet name="input">
							<h:selectOneMenu value="#{bk.matrikel}">
								<f:selectItems value="#{tableBks.matrikelArray}" var="matrikel"
									itemLabel="#{matrikel}" itemValue="#{matrikel}" />
							</h:selectOneMenu>
						</f:facet>
					</p:cellEditor>
				</p:column>

				<br></br>

				<p:column style="width:6%">
					<p:rowEditor />
					<p:commandLink action="#{bk.delete}">
						<h:graphicImage library="img" value="/img/ui-icon-trash.png"></h:graphicImage>
					</p:commandLink>

				</p:column>

			</p:dataTable>

		</h:form>
		<br></br>
		<h:form>
			<p:button value="Zurück" outcome="booksBack"></p:button>
		</h:form>

	</h:body>
</f:view>

</html>